﻿using FastExecutor.Base.Util;
using FastExecutor.ORG.Util;
using FastORM.Attribute;
using FastORM.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FastExecutor.ORG.Entity
{
    public class Frame_OperateLog : BaseEntity
    {
        [Key]
        public string RowGuid { set; get; }
        public string UGuid { set; get; }
        public string UName { set; get; }
        public string DGuid { set; get; }
        public string DName { set; get; }
        public string OperateType { set; get; }
        public string OperateContent { set; get; }
        public DateTime OperateDate { set; get; }
        public string FromIP { set; get; }

        public Frame_OperateLog()
        {

        }

        public Frame_OperateLog(string OperateType, string OperateContent)
        {
            this.OperateType = OperateType;
            this.OperateContent = OperateContent;
            RowGuid = CommonUtil.CreateCommonGuid();
            OperateDate = DateTime.Now;
            FromIP = CommonUtil.GetClientIP();
            TokenEntity Token = InjectUtil.Container.Resolve<AuthUtil>().GetToken();
            if (Token!=null)
            {
                UGuid = Token.UserGuid;
                UName = Token.DisplayName;
                DGuid = Token.OUGuid;
                DName = Token.OUName;
            }
        }
    }
}
